package com.fmdj.customer.service.impl;

import com.fmdj.common.exception.GlobalException;
import com.fmdj.common.util.CommonResult;
import com.fmdj.customer.controller.form.InsertCommentForm;
import com.fmdj.customer.feign.OdrServiceApi;
import com.fmdj.customer.service.OrderCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderCommentServiceImpl implements OrderCommentService {

    @Autowired
    private OdrServiceApi odrServiceApi;

    @Override
    public int insertComment(InsertCommentForm form) {
        CommonResult r = odrServiceApi.insertComment(form);
        int rows = (int) r.get(CommonResult.RETURN_ROW);
        if (rows !=1) {
            throw new GlobalException("保存订单评价失败");
        }
        return rows;
    }
}
